package com.spzx.product.api.fallback;

import com.spzx.common.core.domain.R;
import com.spzx.product.api.RemoteSkuStockService;
import com.spzx.product.api.vo.SkuLockVo;
import org.springframework.cloud.openfeign.FallbackFactory;

import java.util.List;

public class RemoteSkuStockFallbackFactory implements FallbackFactory<RemoteSkuStockService> {

    @Override
    public RemoteSkuStockService create(Throwable cause) {
        return new RemoteSkuStockService() {
            @Override
            public R<String> checkAndLock(String orderNo, List<SkuLockVo> skuLockVoList, String source) {
                return R.fail("检查与锁定商品失败:" + cause.getMessage());
            }
        };
    }
}